package com.chat.common.common.exception;

import com.chat.common.common.domain.enums.CommonErrorEnum;
import io.swagger.models.auth.In;
import lombok.Data;

@Data
public class BusinessException extends RuntimeException{
    protected Integer errorCode;
    protected String errorMsg;

    public BusinessException(String errorMsg) {
        super(errorMsg);
        this.errorCode= CommonErrorEnum.BUSINESS_ERROR.getErrorCode();
        this.errorMsg = errorMsg;
    }
    public BusinessException(Integer errorCode, String errorMsg) {
        super(errorMsg);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public BusinessException(CommonErrorEnum errorEnum) {
        super(errorEnum.getErrorMsg());
        this.errorCode= errorEnum.getErrorCode();
        this.errorMsg =errorEnum.getErrorMsg();
    }
}
